home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / inet / internet-drafts / draft-ietf-822ext-mime-part2-00.txt < prev    next >
Text File  |  1993-03-23  |  20KB  |  532 lines

  1. Network Working Group                                           K. Moore
  2. Internet Draft                                   University of Tennessee
  3.                                                            22 March 1993
  4.  
  5.  
  6.          MIME (Multipurpose Internet Mail Extensions) Part Two:
  7.               Message Header Extensions for Non-ASCII Text
  8.  
  9.  
  10. Status of this Memo
  11.  
  12.    This document is an Internet Draft.  Internet Drafts are working
  13.    documents of the Internet Engineering Task Force (IETF), its Areas,
  14.    and its Working Groups.  Note that other groups may also distribute
  15.    working documents as Internet Drafts.
  16.  
  17.    Internet Drafts are valid for a maximum of six months and may be
  18.    updated, replaced, or obsoleted by other documents at any time.  (The
  19.    file 1id-abstracts.txt, available via anonymous ftp from nic.ddn.mil,
  20.    describes the current status of each Internet Draft.)  It is not
  21.    appropriate to use an Internet Draft as reference material or to cite
  22.    one other than as a "work in progress".
  23.  
  24.    This document is a revision of RFC 1342.  If approved by the IETF
  25.    message format extensions working group, it will be submitted to the
  26.    IESG as a candidate for Draft Standard status.  Distribution of this
  27.    memo is unlimited.  Please send comments to
  28.    ietf-822@dimacs.rutgers.edu.
  29.  
  30.  
  31. Abstract
  32.  
  33.    This memo describes an extension to the message format defined in
  34.    RFC 1341++ [1], to allow the representation of character sets other
  35.    than ASCII in RFC 822 message headers.  The extensions described were
  36.    designed to be highly compatible with existing Internet mail handling
  37.    software, and to be easily implemented in mail readers that support
  38.    RFC 1341++.
  39.  
  40.  
  41. Introduction
  42.  
  43.    RFC 1341++ describes a mechanism for denoting textual body parts
  44.    which are coded in various character sets, as well as methods for
  45.    encoding such body parts as sequences of printable ASCII characters.
  46.    This memo describes similar techniques to allow the encoding of non-
  47.    ASCII text in various portions of a RFC 822 [2] message header, in a
  48.    manner which is unlikely to confuse existing message handling
  49.    software.
  50.  
  51.    Like the encoding techniques described in RFC 1341++, the techniques
  52.    outlined here were designed to allow the use of non-ASCII characters
  53.    in message headers in a way which is unlikely to be disturbed by the
  54.    quirks of existing Internet mail handling programs.  In particular,
  55.    some mail relaying programs are known to (a) delete some message
  56.  
  57.  
  58.  
  59. K. Moore                                                        [Page 1]
  60. Internet Draft         Expires 22 September 1993           22 March 1993
  61.  
  62.  
  63.  
  64.    header fields while retaining others, (b) rearrange the order of
  65.    addresses in To or Cc fields, (c) rearrange the (vertical) order of
  66.    header fields, and/or (d) "wrap" message headers at different places
  67.    than those in the original message.  In addition, some mail reading
  68.    programs are known to have difficulty correctly parsing message
  69.    headers which, while legal according to RFC 822, make use of
  70.    backslash-quoting to "hide" special characters such as "<", ",", or
  71.    ":", or which exploit other infrequently-used features of that
  72.    specification.
  73.  
  74.    While it is unfortunate that these programs do not correctly
  75.    interpret RFC 822 headers, to "break" these programs would cause
  76.    severe operational problems for the Internet mail system.  The
  77.    extensions described in this memo therefore do not rely on little-
  78.    used features of RFC 822.  Instead, certain sequences of "ordinary"
  79.    printable ASCII characters (which are assumed to be unlikely to
  80.    otherwise appear in message headers) are reserved for use as encoded
  81.    data.  The characters used in these encodings are restricted to those
  82.    which do not have special meanings in the context in which the
  83.    encoded text appears.
  84.  
  85.  
  86. Notes
  87.  
  88.    This memo relies heavily on notation and terms defined RFC 822 and
  89.    RFC 1341++.  In particular, the syntax for the EBNF used in this memo
  90.    is defined in RFC 822, as well as many of the terms used in the
  91.    grammar for the header extensions defined here.  Successful
  92.    implementation of this protocol extension requires careful attention
  93.    to the details of both RFC 822 and RFC 1341++.
  94.  
  95.    When the term "ASCII" appears in this memo, it refers to the "7-Bit
  96.    American Standard Code for Information Interchange", ANSI X3.4-1986.
  97.    The MIME charset name for this character set is "US-ASCII".  When not
  98.    specifically referring to the MIME charset name, this document uses
  99.    the term "ASCII", both for brevity and for consistency with RFC 822.
  100.    However, implementors are warned that the character set name must be
  101.    spelled "US-ASCII" in MIME message and body part headers.
  102.  
  103.  
  104. Encodings
  105.  
  106.    An "encoded-word" is a sequence of printable ASCII characters that
  107.    begins with "=?", ends with "?=", and has two "?"s in between.  It
  108.    specifies a character set and an encoding method, and also includes
  109.    the original text encoded as ASCII characters, according to the rules
  110.    for that encoding method.
  111.  
  112.    A mail composer that implements this specification will provide a
  113.    means of inputting non-ASCII text in header fields, but will
  114.    translate these fields (or appropriate portions of these fields) into
  115.  
  116.  
  117.  
  118. K. Moore                                                        [Page 2]
  119. Internet Draft         Expires 22 September 1993           22 March 1993
  120.  
  121.  
  122.  
  123.    encoded- words before inserting them into the message header.
  124.  
  125.    A mail reader that implements this specification will recognize
  126.    encoded-words when they appear in certain portions of the message
  127.    header.  Instead of displaying the encoded-word "as is", it will
  128.    reverse the encoding and display the original text in the designated
  129.    character set.
  130.  
  131.    An "encoded-word" is more precisely defined by the following ABNF
  132.    grammar, using the notation of RFC 822:
  133.  
  134.    encoded-word = "=" "?" charset "?" encoding "?" encoded-text "?" "="
  135.  
  136.    charset = token    ; legal charsets defined by RFC 1341++
  137.  
  138.    encoding = token   ; Either "B" or "Q"
  139.  
  140.    token = 1*<Any CHAR except SPACE, CTLs, and tspecials>
  141.  
  142.    tspecials = "(" / ")" / "<" / ">" / "@" / "," / ";" / ":" / "\" /
  143.                <"> / "/" / "[" / "]" / "?" / "." / "="
  144.  
  145.    encoded-text = 1*<Any printable ASCII character other than "?" or SPACE>
  146.                       ; (but see "Use of encoded-words in message
  147.                       ; headers", below)
  148.  
  149.    Both "encoding" and "charset" names are case-independent.  Thus
  150.    "ISO-8859-1" is equivalent to "iso-8859-1", and the "Q" encoding may
  151.    be spelled either "Q" or "q".
  152.  
  153.    An encoded-word may not be more than 75 characters long, including
  154.    charset, encoding, encoded-text, and delimiters.  If it is desirable
  155.    to encode more text than will fit in an encoded-word of 75
  156.    characters, multiple encoded-words (separated by SPACE or newline)
  157.    may be used.  While there is no limit to the length of a multiple-
  158.    line header field, each line of a header field that contains one or
  159.    more encoded-words is limited to 76 characters.  NOTE: These
  160.    restrictions are included not only to ease interoperability through
  161.    internetwork mail gateways, but also to impose a limit on the amount
  162.    of lookahead a header parser must employ (while looking for a final
  163.    ?= delimiter) before it can decide whether a token is an encoded-word
  164.    or something else.
  165.  
  166.    Initially, the legal values for "encoding" are "Q" and "B".  These
  167.    encodings are described below.  The "Q" encoding is recommended for
  168.    use with Latin character sets, and the "B" encoding for all others.
  169.    Nevertheless, a mail reader which claims to recognize encoded-words
  170.    MUST be able to accept either encoding for any character set which it
  171.    supports.
  172.  
  173.    Only a subset of the printable ASCII characters may be used in
  174.  
  175.  
  176.  
  177. K. Moore                                                        [Page 3]
  178. Internet Draft         Expires 22 September 1993           22 March 1993
  179.  
  180.  
  181.  
  182.    encoded-text.  The SPACE character is not allowed, so that the
  183.    beginning and end of an encoded-word are obvious.  The "?" character
  184.    is used within an encoded-word to separate the various portions of
  185.    the encoded-word from one another, and thus cannot appear in the
  186.    encoded-text portion.  Other characters are also illegal in certain
  187.    contexts.  For example, an encoded-word in a "phrase" preceeding an
  188.    address in a From header field may not contain any of the "specials"
  189.    defined in RFC 822.  Finally, certain other characters are disallowed
  190.    in some contexts, to ensure reliability for messages that pass
  191.    through internetwork mail gateways.
  192.  
  193.    The "B" encoding automatically meets these requirements.  The "Q"
  194.    encoding allows a wide range of printable characters to be used in
  195.    non-critical locations in the message header (e.g., Subject), with
  196.    fewer characters available for use in other locations.
  197.  
  198.  
  199. The "B" encoding
  200.  
  201.    The "B" encoding is identical to the "BASE64" encoding defined by
  202.    RFC 1341++.
  203.  
  204.  
  205. The "Q" encoding
  206.  
  207.    The "Q" encoding is similar to the "Quoted-Printable" content-
  208.    transfer-encoding defined in RFC 1341++.  It is designed to allow
  209.    text containing mostly ASCII characters to be decipherable on an
  210.    ASCII terminal without decoding.
  211.  
  212.    1.  Any 8-bit value may be represented by a "=" followed by two
  213.        hexadecimal digits.  For example, if the character set in use
  214.        were ISO-8859-1, the "=" character would thus be encoded as
  215.        "=3D", and a SPACE by "=20".
  216.  
  217.    2.  The 8-bit hexadecimal value 20 (e.g., ISO-8859-1 SPACE) may be
  218.        represented as "_" (underscore, ASCII 95.).  (This character may
  219.        not pass through some internetwork mail gateways, but its use
  220.        will greatly enhance readability of "Q" encoded data with mail
  221.        readers that do not support this encoding.)  Note that the "_"
  222.        always represents hexadecimal 20, even if the SPACE character
  223.        occupies a different code position in the character set in use.
  224.  
  225.    3.  8-bit values which correspond to printable ASCII characters other
  226.        than "=", "?", "_" (underscore), and SPACE may be represented as
  227.        those characters.  (But see "Use of encoded-words in message
  228.        headers", below).
  229.  
  230.  
  231.  
  232.  
  233.  
  234.  
  235.  
  236. K. Moore                                                        [Page 4]
  237. Internet Draft         Expires 22 September 1993           22 March 1993
  238.  
  239.  
  240.  
  241. Character sets
  242.  
  243.    In an encoded-word, the character set associated with the unencoded text
  244.    is specified by a charset.  A charset can be any of the character set
  245.    names allowed in an RFC 1341++ "charset" parameter of a "text/plain"
  246.    body part, or any character set name registered with IANA for use with
  247.    the MIME text/plain content-type.  (See section 7.1.1 of RFC 1341++ for
  248.    a list of charsets defined in that document).
  249.  
  250.    Some character sets use code-switching techniques to switch between
  251.    "ASCII mode" and other modes.  Display of each encoded-word using such a
  252.    character set implicitly begins in ASCII mode.  If the encoded-text in
  253.    an encoded-word contains control codes to switch out of ASCII mode, it
  254.    must also contain additional control codes such that ASCII mode is again
  255.    selected at the end of the encoded-word.  (This rule applies separately
  256.    to each encoded-word, including adjacent encoded-words within a single
  257.    header field.)
  258.  
  259.    When there is a possibility of using more than one character set to
  260.    represent the text in an encoded-word, and in the absence of private
  261.    agreements between sender and recipients of a message, it is recommended
  262.    that members of the ISO-8859-* series be used in preference to other
  263.    character sets.  Among the various ISO-8859-* character sets, the
  264.    lowest-numbered set which contains all of the required characters should
  265.    be used.
  266.  
  267.  
  268. Use of encoded-words in message headers
  269.  
  270.    A sequence of one or more encoded-words is used to represent non- ASCII
  271.    textual data within a header field.  An encoded-word must be separated
  272.    from an adjacent encoded-word, "word", "text", "ctext", or "special" by
  273.    a linear white-space character or a newline.  When displaying a
  274.    particular header field that contains multiple encoded-words, any
  275.    linear-white-space that separates a pair of adjacent encoded-words is
  276.    ignored.  (This is to allow the use of multiple encoded-words to
  277.    represent long strings of unencoded text, without having to separate
  278.    encoded-words where spaces occur in the unencoded text.)
  279.  
  280.    Each encoded-word must represent an integral number of characters; a
  281.    character may not be split across adjacent encoded-words.
  282.  
  283.    An encoded-word may appear in a message header or body part header
  284.    according to the following rules:
  285.  
  286.    - An encoded-word may replace a "text" token (as defined by RFC 822) in:
  287.      (1) a Subject or Comments header field, (2) any extension message
  288.      header field, (3) any user-defined message header field, or (4) any
  289.      RFC 1341++ body part header field (such as Content-Description) for
  290.      which the field body contains only "text"s.
  291.  
  292.  
  293.  
  294.  
  295. K. Moore                                                        [Page 5]
  296. Internet Draft         Expires 22 September 1993           22 March 1993
  297.  
  298.  
  299.  
  300.    - An encoded-word may appear within a comment delimited by "(" and ")",
  301.      i.e., wherever a "ctext" is allowed.  More precisely, the RFC 822 ABNF
  302.      definition for "comment" is amended as follows:
  303.  
  304.      comment = "(" *(ctext / quoted-pair / comment / encoded-word) ")"
  305.  
  306.      A "Q"-encoded encoded-word which appears in a comment MUST NOT contain
  307.      the characters "(", ")" or "\".
  308.  
  309.    - As a replacement for a "word" entity within a "phrase", for example,
  310.      one that precedes an address in a From, To, or Cc header.  The ABNF
  311.      definition for phrase from RFC 822 thus becomes:
  312.  
  313.      phrase = 1*(encoded-word / word)
  314.  
  315.      In this case the set of characters that may be used in a "Q"-encoded
  316.      encoded-word is restricted to: <upper and lower case ASCII letters,
  317.      decimal digits, "!", "*", "+", "-", "/", "=", and "_" (underscore,
  318.      ASCII 95.)>.
  319.  
  320.      These are the ONLY locations where an encoded-word may appear.  In
  321.      particular, an encoded-word MUST NOT appear in any portion of an
  322.      "address".  In addition, an encoded-word MUST NOT be used in a
  323.      Received header field.
  324.  
  325.      Whenever such words appear in a header being displayed, an enlightened
  326.      mail reader will decode the text and render it appropriately.
  327.  
  328.      Only textual data (printable and white space characters) should be
  329.      encoded using this scheme.  However, since these encoding schemes
  330.      allow the encoding of arbitrary 8-bit values, mail readers that
  331.      implement this decoding should also ensure that display of the decoded
  332.      data on the recipient's terminal will not cause unwanted side-effects.
  333.  
  334.      Use of these methods to encode non-textual data (e.g., pictures or
  335.      sounds) is not defined by this memo.  Use of encoded-words to
  336.      represent strings of purely ASCII characters is allowed, but
  337.      discouraged.
  338.  
  339.  
  340. Recognition of encoded-words in message headers.
  341.  
  342.    An encoded-word may be distinguished from an ordinary "word", "text", or
  343.    "ctext", as follows: An encoded-word begins with "=?", ends with "?=",
  344.    contains exactly four "?" characters including the delimiters, and is
  345.    followed by a SPACE or newline.  If the "word", "text", or "ctext" does
  346.    not meet the above tests, it should be displayed as it appears in the
  347.    message header.
  348.  
  349.    If the mail reader does not support the character set used, it may
  350.    either display the encoded-word as ordinary text (i.e., as it appears in
  351.  
  352.  
  353.  
  354. K. Moore                                                        [Page 6]
  355. Internet Draft         Expires 22 September 1993           22 March 1993
  356.  
  357.  
  358.  
  359.    the header), or it may substitute an appropriate message indicating that
  360.    the decoded text could not be displayed.
  361.  
  362.  
  363. Conformance
  364.  
  365.    A mail composing program claiming compliance with this specification
  366.    MUST ensure that any string of printable ASCII characters in a "text" or
  367.    "ctext" entity within a header, or any "atom" within a "phrase", that
  368.    begins with "=?" and ends with "?=" be a valid encoded-word.
  369.  
  370.    A mail reading program claiming compliance with this specification must
  371.    be able to distinguish encoded-words from "text", "ctext", or "word"s
  372.    anytime they appear in appropriate places in message headers.  In
  373.    addition, the program must be able to display the unencoded text if the
  374.    character set is "US-ASCII".  For the ISO-8859-* character sets, the
  375.    mail reading program must at least be able to display the characters
  376.    which are also in the ASCII set.
  377.  
  378.  
  379. Examples
  380.  
  381.    From: =?US-ASCII?Q?Keith_Moore?= <moore@cs.utk.edu>
  382.    To: =?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= <keld@dkuug.dk>
  383.    CC: =?ISO-8859-1?Q?Andr=E9_?= Pirard <PIRARD@vm1.ulg.ac.be>
  384.    Subject: =?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?=
  385.     =?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=
  386.  
  387.    From: =?ISO-8859-1?Q?Olle_J=E4rnefors?= <ojarnef@admin.kth.se>
  388.    To: ietf-822@dimacs.rutgers.edu, ojarnef@admin.kth.se
  389.    Subject: Time for ISO 10646?
  390.  
  391.    To: Dave Crocker <dcrocker@mordor.stanford.edu>
  392.    Cc: ietf-822@dimacs.rutgers.edu, paf@comsol.se
  393.    From: =?ISO-8859-1?Q?Patrik_F=E4ltstr=F6m?= <paf@nada.kth.se>
  394.    Subject: Re: RFC-HDR care and feeding
  395.  
  396.    From: Nathaniel Borenstein <nsb@thumper.bellcore.com>
  397.          (=?iso-8859-8?b?7eXs+SDv4SDp7Oj08A==?=)
  398.    To: Greg Vaudreuil <gvaudre@NRI.Reston.VA.US>, Ned Freed
  399.       <ned@innosoft.com>, Keith Moore <moore@cs.utk.edu>
  400.    Subject: Test of new header generator
  401.    MIME-Version: 1.0
  402.    Content-type: text/plain; charset=ISO-8859-1
  403.  
  404.  
  405.  
  406. References
  407.  
  408.    [1] Borenstein N., and N. Freed, "MIME (Multipurpose Internet Mail
  409.        Extensions) Part One:  Mechanisms for Specifying and Describing the
  410.  
  411.  
  412.  
  413. K. Moore                                                        [Page 7]
  414. Internet Draft         Expires 22 September 1993           22 March 1993
  415.  
  416.  
  417.  
  418.        Format of Internet Message Bodies", Internet-Draft RFC 1341++,
  419.        Bellcore, Innosoft, March 1993.
  420.  
  421.    [2] Crocker, D., "Standard for the Format of ARPA Internet Text
  422.        Messages", RFC 822, UDEL, August 1982.
  423.  
  424.  
  425. Security Considerations
  426.  
  427.    Security issues are not discussed in this memo.
  428.  
  429.  
  430. Author's Address
  431.  
  432.    Keith Moore
  433.    University of Tennessee
  434.    107 Ayres Hall
  435.    Knoxville TN 37996-1301
  436.  
  437.    EMail: moore@cs.utk.edu
  438.  
  439.  
  440.  
  441.  
  442.  
  443.  
  444.  
  445.  
  446.  
  447.  
  448.  
  449.  
  450.  
  451.  
  452.  
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472. K. Moore                                                        [Page 8]
  473. Internet Draft         Expires 22 September 1993           22 March 1993
  474.  
  475.  
  476.  
  477.                        Appendix - changes from RFC 1342
  478.  
  479.  
  480.      1. Title changed to say "MIME Part 2".
  481.  
  482.      2. Character sets allowed to include IANA-registered charsets in
  483.         addition to those defined in RFC 1341++.  (X-* charsets are still
  484.         excluded.)
  485.  
  486.      3. RFC 1342 said, in effect, "don't display a space or newline
  487.         following an encoded-word".  This memo says, "don't display any
  488.         linear-white-space between adjacent encoded-words."
  489.  
  490.      4. Each encoded-word must now contain an integral number of
  491.         characters.
  492.  
  493.      5. Added language about charsets that use code-switching techniques.
  494.  
  495.      6. "Compliance" paragraph changed -- =?something?= is now only
  496.         required to be a valid encoded-word if the =?something?= is either
  497.         contained in a "text", or is an "atom" within a "phrase".
  498.  
  499.      7. Clarified the 76 character per line limit (it's per line, not per
  500.         header field).
  501.  
  502.      8. Define "charset" and "encoding" to be case-independent.
  503.  
  504.      9. Added note to explicitly refer the reader to RFC 822 and
  505.         RFC 1341++.
  506.  
  507.     10. Added note re: usage of "ASCII" vs. "US-ASCII".
  508.  
  509.  
  510.  
  511.  
  512.  
  513.  
  514.  
  515.  
  516.  
  517.  
  518.  
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531. K. Moore                                                        [Page 9]
  532.